import 'package:pornhub_app/routes/routes.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../../../services/user_service.dart';
import '../../../utils/color.dart';

///  分享赚钱和金币充值入口
class GradienButton extends StatelessWidget {
  final String textTitle;
  final String textContent;
  final String colorOne;
  final String colorTwo;
  final String imgSource;
  final int type;
  final UserService service;

  const GradienButton(
      {super.key,
      required this.textTitle,
      required this.textContent,
      required this.colorOne,
      required this.colorTwo,
      required this.imgSource,
      required this.type,
      required this.service});

  @override
  Widget build(BuildContext context) {
    void onVipClick() {
      if (type == 1) {
        Get.toVip(tabInitIndex: 1);
      } else {
        Get.toShare();
      }
    }

    return Container(
      decoration: BoxDecoration(
        gradient: LinearGradient(
          colors: [COLOR.hexColor(colorOne), COLOR.hexColor(colorTwo)],
        ),
        borderRadius: BorderRadius.circular(6.0),
      ),
      child: InkWell(
        onTap: () => onVipClick(),
        child: Flex(
          direction: Axis.horizontal,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            SizedBox(
              width: 179.w,
              height: 60.w,
              child: Flex(
                direction: Axis.horizontal,
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: [
                  const SizedBox(width: 9.0),
                  Expanded(
                    flex: 1,
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Text(
                          textTitle,
                          style: TextStyle(
                            fontSize: 14.sp,
                            color: COLOR.hexColor("#666666"),
                            fontWeight: FontWeight.w600,
                          ),
                        ),
                        const SizedBox(height: 2),
                        Text(
                          textContent,
                          style: TextStyle(
                            fontSize: 12.sp,
                            color: COLOR.hexColor("#FF6B97"),
                            fontWeight: FontWeight.w600,
                          ),
                        ),
                      ],
                    ),
                  ),
                  Image.asset(
                    imgSource,
                    width: 48.w,
                    height: 48.w,
                  ),
                  const SizedBox(width: 9.0),
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}
